package cn.ydt.ydt.work.webapi.mapper;

import cn.ydt.ydt.pojo.work.model.Work;
import cn.ydt.ydt.pojo.work.vo.WorkDetailsVO;
import cn.ydt.ydt.pojo.work.vo.WorkSimpleVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface WorkMapper {
    //增加任务
    int addWork(Work work);

    //删除任务
    int deleteByWorkID(@Param("workId") Long workId, @Param("modifyTime") Date modifyTime);

    //删除全部已完成任务
    int deleteAllWork();

    //完成任务
    int finishWork(@Param("workId") Long workId, @Param("finishTime") Date finishTime,
                   @Param("modifyTime") Date modifyTime);

    //分配任务
    int setWork(@Param("workId") Long workId, @Param("volunteerId") Long volunteerId, @Param("modifyTime") Date modifyTime);

    //根据workId查询任务
    WorkSimpleVO getByWorkId(Long workId);

    WorkDetailsVO getDetailsWork(Long workId);


    //查询任务列表,未完成的在前面
    List<WorkDetailsVO> list();

    //    查询未完成列表
    List<WorkDetailsVO> listNotFinish();

    //根据userId查询任务,未完成的在前面
    List<WorkSimpleVO> listByUserId(Long userId);

    //查询出任务进行中的志愿者ID
    List<Integer> listVolunteer();

    //根据volunteerId查询
    List<WorkDetailsVO> listByVolunteerId(Long volunteerId);
}
